from openpyxl import load_workbook

"""
实现功能：
    按照指定格式批量命名
"""

look_up_table_path = 'D:/pythonProject/测试/Name_Number.xlsx'
look_up_table_row_start = 2
look_up_table_row_number = 32

# 读取excel，匹配学号：姓名
name_number_dict = {}
number_lunwen_dict = {}
look_up_table_excel = load_workbook(look_up_table_path)
look_up_table_all_sheet = look_up_table_excel.get_sheet_names()
look_up_table_sheet = look_up_table_excel.get_sheet_by_name(look_up_table_all_sheet[0])
for i in range(look_up_table_row_start, look_up_table_row_start + look_up_table_row_number):
    number = look_up_table_sheet.cell(i, 1).value
    name = look_up_table_sheet.cell(i, 2).value
    lunwen = look_up_table_sheet.cell(i, 3).value
    name_number_dict[number] = name
    number_lunwen_dict[number] = lunwen

print(name_number_dict)
print(number_lunwen_dict)
